/**********************************************************************
* <pre>
* FILE : ServiceActivityManageSummarySearch.java
* CLASS : ServiceActivityManageSummarySearch
*
* AUTHOR : PGM
*
* FUNCTION :服务活动管理---服务活动评估查询
*
*
*======================================================================
* CHANGE HISTORY LOG
*----------------------------------------------------------------------
* MOD. NO.| DATE     | NAME | REASON | CHANGE REQ.
*----------------------------------------------------------------------
*         |2010-06-13| PGM  | Created |
* DESCRIPTION:
* </pre>
***********************************************************************/
/**
 * $Id: ServiceActivityManageSummarySearch.java,v 1.1 2010/08/16 01:44:11 yuch Exp $
 */
package com.infodms.dms.actions.claim.serviceActivity;
import java.util.Map;

import org.apache.log4j.Logger;
import com.infodms.dms.bean.AclUserBean;
import com.infodms.dms.bean.TtAsActivityBean;
import com.infodms.dms.common.Constant;
import com.infodms.dms.common.ErrorCodeConstant;
import com.infodms.dms.common.getCompanyId.GetOemcompanyId;
import com.infodms.dms.dao.claim.serviceActivity.ServiceActivityManageSummarySearchDao;
import com.infodms.dms.exception.BizException;
import com.infodms.dms.po.TtAsActivityEvaluatePO;
import com.infoservice.mvc.context.ActionContext;
import com.infoservice.mvc.context.RequestWrapper;
import com.infoservice.po3.bean.PageResult;
/**
 * Function       :  服务活动管理---服务活动评估查询
 * @author        :  PGM
 * CreateDate     :  2010-06-13
 * @version       :  0.1
 */
public class ServiceActivityManageSummarySearch {
	private Logger logger = Logger.getLogger(ServiceActivityManageSummarySearch.class);
	private ServiceActivityManageSummarySearchDao dao = ServiceActivityManageSummarySearchDao.getInstance();
	private ActionContext act = ActionContext.getContext();//获取ActionContext
	private AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
	private final String ServiceActivityManageSummarySearchInitUrl = "/jsp/claim/serviceActivity/serviceActivityManageSummarySearch.jsp";//查询页面
	private final String ServiceActivityOptionUrl = "/jsp/claim/serviceActivity/serviceActivityManageSummarySearchInfo.jsp";//编辑页面
	/**
	 * Function       :  服务活动管理---服务活动评估查询页面初始化
	 * @param         :  
	 * @return        :  serviceActivityManageSummarySearchInit
	 * @throws        :  Exception
	 * LastUpdate     :  2010-06-13
	 */
	public void serviceActivityManageSummarySearchInit(){
		try {
			act.setForword(ServiceActivityManageSummarySearchInitUrl);
		} catch (Exception e) {
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"服务活动管理---服务活动评估查询页面初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * Function       :  根据条件查询服务活动管理---服务活动评估查询中符合条件的信息
	 * @param         :  request-活动编号、经销商代码、活动开始日期、活动结束日期
	 * @return        :  服务活动管理
	 * @throws        :  Exception
	 * LastUpdate     :  2010-06-13
	 */
	public void serviceActivityManageSummarySearchQuery(){
		try {
			RequestWrapper request = act.getRequest();
			String activityCode = request.getParamValue("activityCode");      //活动编号
			String dealerCode = request.getParamValue("dealerCode");         //经销商代码
			String dealerName = request.getParamValue("dealerName");         //经销商名称
			String startdate = request.getParamValue("startDate");           //活动开始日期
			String enddate = request.getParamValue("endDate");               //活动结束日期
			Long companyId=GetOemcompanyId.getOemCompanyId(logonUser);      //公司ID
			TtAsActivityBean ActivityBean = new TtAsActivityBean();
			ActivityBean.setActivityCode(activityCode);
			ActivityBean.setDealerCode(dealerCode);
			ActivityBean.setDealerName(dealerName);
			ActivityBean.setStartdate(startdate);
			ActivityBean.setEnddate(enddate);
			ActivityBean.setCompanyId(String.valueOf(companyId));
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			PageResult<Map<String, Object>> ps = dao.getServiceActivityManageSummarySearchQuery(ActivityBean,curPage,Constant.PAGE_SIZE );
			act.setOutData("ps", ps);
			act.setForword(ServiceActivityManageSummarySearchInitUrl);
		}catch (Exception e) {
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"服务活动管理---服务活动评估查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * Function         : 服务活动管理---服务活动评估查询[编辑]查询方法：状态为：[已经下发]的活动
	 * @param           : request-活动ID
	 * @return          : 满足条件的服务活动管理信息
	 * @throws          : 
	 * LastUpdate       : 2010-06-13
	 */
	public void	serviceActivitySummaryQuery(){
		try {
			RequestWrapper request = act.getRequest();
			String activityId = request.getParamValue("activityId");    //活动ID
			Long companyId=GetOemcompanyId.getOemCompanyId(logonUser);  //公司ID
			TtAsActivityEvaluatePO evaluatePO=dao.serviceActivitySummaryQuery(activityId,companyId);//调用服务活动评估[编辑]查询方法
			request.setAttribute("evaluatePO", evaluatePO);
			request.setAttribute("activityId", activityId);
			act.setForword(ServiceActivityOptionUrl);//跳转到服务活动评估[编辑]页面
		}catch (Exception e) {
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"服务活动管理---服务活动评估查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
}